int* searchRange(int* nums, int numsSize, int target, int* returnSize){
    int first = 0, left= 0, right = numsSize - 1;

    int *res = malloc(sizeof(int)*2);
    res[0] = -1; res[1] = -1;
    *returnSize = 2;
    if (numsSize == 0) return res;

    // 找第一个位置
    while (left < right) {
        int mid = (left + right) / 2;   // mid靠左
        if (nums[mid] >= target)  {
            right = mid;    // 向左慢慢逼近
        } else {
            left = mid + 1; 
        }
    }
    if (nums[left] != target) return res;
    res[0] = left;

    // 找最后一个位置
    right = numsSize - 1;
    while (left < right) {
        int mid = (left + right + 1) / 2;   // mid靠右
    
        if (nums[mid] <= target)  {
            left = mid;  
        } else {
            right = mid - 1;
        }
    }
    res[1] = left;

    return res;
}